﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Interactivity;
using System.Windows.Controls;
using System.Windows.Threading;
using System.Collections.Specialized;
using System.Windows.Media.Animation;
    
namespace TouchControls
{
    public class ListItemAnimateFadeBehavior : ListItemAnimateBehaviorBase
    {
        protected override void AnimateItem(Storyboard sb, ListBoxItem item, TimeSpan delay)
        {
            var holdanimation = this.AddAnimation(sb, TimeSpan.FromMilliseconds(0));
            holdanimation.To = 0;
            holdanimation.Duration = TimeSpan.FromMilliseconds(0);

            var animation = this.AddAnimation(sb, delay);

            animation.From = 0;
            animation.To = 1;

            Storyboard.SetTarget(holdanimation, item);
            Storyboard.SetTargetProperty(holdanimation, new PropertyPath(ListBoxItem.OpacityProperty.Name));
            Storyboard.SetTarget(animation, item);
            Storyboard.SetTargetProperty(animation, new PropertyPath(ListBoxItem.OpacityProperty.Name));
        }

        
    }
}
